// --------------------------------------------------------------------------------------------------------------------
// <copyright file="reportOutputQuickTools.cs" company="imbVeles" >
//
// Copyright (C) 2018 imbVeles
//
// This program is free software: you can redistribute it and/or modify
// it under the +terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/. 
// </copyright>
// <summary>
// Project: imbSCI.Core
// Author: Goran Grubic
// ------------------------------------------------------------------------------------------------------------------
// Project web site: http://blog.veles.rs
// GitHub: http://github.com/gorangrubic
// Mendeley profile: http://www.mendeley.com/profiles/goran-grubi2/
// ORCID ID: http://orcid.org/0000-0003-2673-9471
// Email: hardy@veles.rs
// </summary>
// ------------------------------------------------------------------------------------------------------------------

//using FSharp.Markdown.Pdf;

namespace imbSCI.Core.reporting
{
    using imbSCI.Core.extensions.io;
    using System;
    using System.IO;

    public static class reportOutputQuickTools
    {
        /// <summary>
        /// Saves the markdown content into PDF.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="filepath">The filepath.</param>
        /// <param name="saveTxtVersionToo">if set to <c>true</c> [save text version too].</param>
        /// <returns></returns>
        public static FileInfo saveMarkdownToPDF(this String content, String filepath, Boolean saveTxtVersionToo = false)
        {
            //filepath = filepath.EnsureEndsWith(".pdf");

            FileInfo fi = null; // filepath.getWritableFile();

            //MarkdownPdf.Transform(content, fi.FullName);

            if (saveTxtVersionToo || true)
            {
                filepath = Path.GetFileNameWithoutExtension(fi.Name) + ".txt";
                fi = filepath.getWritableFile();
                content.saveStringToFile(fi.FullName);
            }

            return fi;
        }
    }
}